<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>扩展运算符</title>
</head>
<body>
<p>扩展运算符(...) 用于取出参数对象所有可遍历属性然后拷贝到当前对象</p>
<script>
    let user = {name:"霏霏",age:18};
    // 对象赋值
    let renkang ={...user};
    console.log(renkang);

    // 对象的属性合并
    let hobby = "仁康";
    let renkang2 = {...user,hobby};
    let renkang3 = {...user,hobby,address:"濮阳"};
    console.log(renkang2);
    console.log(renkang3);

    // ...可以和结构数组组合属性
    let arr =[1,2,3,4,5];
    let [x,y,...z] = arr;
    // x=1 y=2 z=[3,4,5]
    console.log(x,y,z);
</script>


</body>
</html>